package com.magicsoft.share.presenter.my;

import com.magicsoft.share.base.BasePresenter;
import com.magicsoft.share.bean.my.UserInfo;
import com.magicsoft.share.constant.APIService;
import com.magicsoft.share.constant.SPKey;
import com.magicsoft.share.rx_retrofit_network.location.retrofit.RetrofitUtil;
import com.magicsoft.share.rx_retrofit_network.location.rxandroid.LoadingTransformer;
import com.magicsoft.share.rx_retrofit_network.location.rxandroid.NetWorkTransformer;
import com.magicsoft.share.rx_retrofit_network.location.rxandroid.SimpleObserver;
import com.magicsoft.share.utils.SPUtils;
import com.magicsoft.share.view.my.IVipView;

/**
 * Created by lyf on 2017/11/24/024.
 */

public class VipPresenter extends BasePresenter<IVipView>{
    public void userDetail() {

        RetrofitUtil.getApi(APIService.class)
                .userDetail(SPUtils.getInstance().getString(SPKey.TOKEN), SPUtils.getInstance().getLong(SPKey.ID))
                .compose(new NetWorkTransformer<UserInfo>())
                .compose(new LoadingTransformer<UserInfo>(mContext))
                .subscribe(new SimpleObserver<UserInfo>(mCompositeDisposable) {
                    @Override
                    public void call(UserInfo userInfo) {

                        getView().userDetailSuccess(userInfo);
                    }
                });
    }
}
